//
//  AppDelegate+Umeng.swift
//  YPWatermarkCamera
//
//  Created by 赵新 on 2022/8/8.
//

import Foundation
import YPBedrock

let UmengAppId = "61440877d884567d81146b53"

extension AppDelegate {
    /// 初始化友盟统计
    func configUmeng() {
        UMCrashConfigure.setAppVersion(YPApp.Version, buildVersion: YPApp.BuildVersion)
        let apmConfig = UMAPMConfig.default()
//        #if DEBUG
//        apmConfig.crashAndBlockMonitorEnable = false
//        #else
//        apmConfig.crashAndBlockMonitorEnable = true
//        #endif
        UMCrashConfigure.setAPMConfig(apmConfig)
        UMCrashConfigure.setCrashCBBlock {
            return "uuid: \(WmcDeviceManager.uuid), build_num: \(YPApp.BuildVersion), device: \(YPDevice.Information.generationName)"
        }
        // 初始化sdk
        UMConfigure.initWithAppkey(UmengAppId, channel: channel)
        #if DEBUG
        UMConfigure.setLogEnabled(true)
        #else
        UMConfigure.setLogEnabled(false)
        #endif
        MobClick.setAutoPageEnabled(true)
        UMConfigure.setAnalyticsEnabled(true)
    }
}
